package com.gcu.drivingschool.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 基本用户实体
 * @author zzr
 * @create 2024-04-18-17:13
 */
@Schema(description = "基本用户实体")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseUser {
    /**
     * 主键
     */
    @Schema(description = "主键")
    @TableId
    private Integer id;

    @TableField(exist = false)
    @Schema(hidden = true)
    private String type;

    /**
     * 手机号(11位数字字符)
     */
    @Schema(description = "手机号(11位数字字符)")
    @NotBlank
    @Pattern(regexp = "^\\d{11}$",message = "11位数字字符")
    private String telephone;

    /**
     * 密码(最多60个字符)
     */
    @Schema(description = "密码(最多50个字符)")
    @Size(max = 50,message = "最多50个字符")
    @NotBlank
    private String password;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    public BaseUser(Integer id, String telephone, String password, Date createTime) {
        this.id = id;
        this.telephone = telephone;
        this.password = password;
        this.createTime = createTime;
    }
}
